﻿using System;
using System.Collections.Generic;
using System.Linq;
using HappyBa.Core.Data;

namespace HappyBa.Core.Interfaces
{
    public class MetricsSearch
    {
        public Func<UIStatebleEntityBase, bool> CustomSearch { get; private set; }
        public IList<string> Roles { get; private set; }
        public IList<string> States { get; private set; }
        public IList<int> Users { get; private set; }

        public MetricsSearch(Search search, Func<UIStatebleEntityBase, bool> customSearch = null)
        {
            CustomSearch = customSearch;
            Roles = search.Roles.CheckedItems.Select(x => x.Key).ToArray();
            States = search.States.CheckedItems.Select(x => x.Key).ToArray();
            Users = search.Users.CheckedItems.Select(x => x.Value).ToArray();
        }
    }
}
